<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
<%@ taglib uri="/WEB-INF/lib/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/lib/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/lib/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/lib/c.tld" prefix="c"%>

<script>

function submitForm(opr){
	document.vehiclesFinancesReportForm.opr.value = opr;
	document.vehiclesFinancesReportForm.submit();
}

function searchByModel(opr){
	document.vehiclesFinancesReportForm.opr.value = 'searchByModel';
	document.vehiclesFinancesReportForm.submit();
}

</script>

<html:form action="/vehiclesFinancesReport">
	<html:hidden property="opr" />
	
<table border="0">
				<tr>
					<td align="center"><h3><bean:message key="vehicle.title.reportFinanceVehicle" /></h3></td>
				</tr>
	
</table>

<logic:present name="show">
<table border="0">	
<tr>
	<td width="60%"><h4><bean:message key="vehicle.label.selectType" /></h4></td>
	<td width="20%"><b>Modelo</b><html:radio property="selectedType" value="model" />
	   				<b>Marca</b><html:radio property="selectedType" value="brand" />
	</td>
	<td width="20%"> <a href="javascript:searchByModel()"><bean:message key="vehicle.labels.search" /></a>
	</td>
</tr>
</table>

<table width="100%" style="border: 1px solid #969696;" cellpadding="0" cellspacing="0">
	<tr style="background-color: #969696; height: 20px; font-weight: bold;">
		<td>&nbsp;</td>
		<td width="15%"><bean:message key="vehicle.labels.plate" /></td>
		<td width="10%"><bean:message key="vehicle.labels.year" /></td>
		<td width="15%"><bean:message key="vehicle.labels.value" /></td>
		<td width="10%"><bean:message key="vehicle.labels.brand" /></td>
		<td width="10%"><bean:message key="vehicle.labels.model" /></td>
		<td width="10%"><bean:message key="vehicle.labels.color" /></td>
		<td width="15%"><bean:message key="vehicle.labels.fuel" /></td>
		<td>&nbsp;</td>
	</tr>
	
	<logic:iterate id="vehicle" name="vehiclesCollection" >

	<c:choose>
		<c:when test="${color == '#f3f2f2'}">
			<c:set var="color" value="#e7e6e6" scope="page"/>
		</c:when>
		<c:otherwise>
			<c:set var="color" value="#f3f2f2" scope="page"/>
		</c:otherwise>
	</c:choose>
	
		<tr style="background-color: <c:out value="${color}" />; height: 15px;">
			<td>&nbsp;</td>
			<td><bean:write name="vehicle" property="plate"/></td>
			<td><bean:write name="vehicle" property="year"/></td>
			<td><bean:write name="vehicle" property="value"/></td>
			<td><bean:write name="vehicle" property="model.brand.brand"/></td>
			<td><bean:write name="vehicle" property="model.model"/></td>
			<td><bean:write name="vehicle" property="color.color"/></td>
			<td><bean:write name="vehicle" property="fuel.fuel"/></td>
			<td>&nbsp;</td>
		</tr>
	
	</logic:iterate>

</table>

</logic:present>


<logic:present name="error">
	<table border="0">
				<tr>
					<td align="center"><h3><bean:message key="vehicle.error.null" /></h3></td>
				</tr>
</table>
</logic:present>
</html:form>